package com.fos.BluetoothStory.activity;

import com.fos.BluetoothStory.R;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;

/**
 * 启动页
 * @author fanxing 创建于 Oct 22, 2015
 */
public class WelcomeActivity extends Activity implements AnimatorListener{
	
	private View iv_logo;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_welcome);
		
		iv_logo = findViewById(R.id.iv_logo);
		
//		iv_logo.setScaleX(0f);
//		iv_logo.setScaleY(0f);
//		iv_logo.setAlpha(0.2f);
//		iv_logo.animate().scaleX(1.3f).scaleY(1.3f).alpha(1f).setDuration(2000)
//			.setListener(this).start();
		iv_logo.animate().setDuration(1000).setListener(this).start();
	}

	@Override
	public void onAnimationStart(Animator animation) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onAnimationEnd(Animator animation) {
		if(animation.getDuration() == 2000){
			iv_logo.animate().scaleX(1f).scaleY(1f).setDuration(1000).setListener(this).start();
		}else{
			startActivity(new Intent(this, MainActivity.class));
			finish();
		}
	}

	@Override
	public void onAnimationCancel(Animator animation) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onAnimationRepeat(Animator animation) {
		// TODO Auto-generated method stub
		
	}

}
